<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        body {
            height: 100vh;
            background: #007dea;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .menu-btn {
            width: 80px;
            height: 80px;
            border: 2px solid #fff;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }

        .menu-line {
            width: 50px;
            height: 5px;
            background: #fff;
            margin: 5px 0;
            border-radius: 5px;
            transition: .5s;
        }

        .menu-btn.closed .menu-line:nth-child(1) {
            transform: translateY(15px) rotate(45deg);
        }

        .menu-btn.closed .menu-line:nth-child(2) {
            opacity: 0;
        }

        .menu-btn.closed .menu-line:nth-child(3) {
            transform: translateY(-15px) rotate(-45deg);
        }
    </style>
</head>

<body>
    <div class="menu-btn">
        <div class="menu-line"></div>
        <div class="menu-line"></div>
        <div class="menu-line"></div>
    </div>
</body>
<script>
    var btn = document.querySelector('.menu-btn');
    btn.onclick = function () {
        this.classList.toggle('closed');
    }
</script>

</html>